{% extends "enterprise/base.html" %}
{% block css %}
<link rel="stylesheet" type="text/css" href="/static/css/styles.css">
{% endblock %}
{% block content %}
<script type="text/javascript">
    var primary_menu = "menu_4";
    var sub_menu = "";
</script>
<div class="col-md-12">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <div class="panel-title"><h3>填报概况</h3></div>
            <div class="panel-options">
               <form role="form" action="/searchfillInCompany/" method="post" enctype="" class="form-horizontal pull-left">
                <div class="form-group" style="width:200px;">
                    <label class="control-label">当前批次：</label>
                    <div style="padding-top:7px;width:110px;">{{ current }}</div>
                </div>
                        <div class="form-group">
                            <label class="control-label">填报批次：</label>
                            <div>
                                <select class="form-control" name="fill">
                                    {% for i in enter_fill %}
                                        {% ifequal i.fill_key current%}
                                        <option value="{{ i.fill_key }}" selected="selected">{{ i.fill_key }}</option>
                                        {% else %}
                                    <option value="{{ i.fill_key }}">{{ i.fill_key }}</option>
                                        {% endifequal %}
                                    {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="form-group filter-btn">
                            <button type="submit" class="btn btn-green">查询</button>
                        </div>
                    </form>
            </div>
        </div>
        <div class="panel-body with-table">
            <div class="wrapp-inner">
        		<div class="main clearfix">
                    <div class="col-md-10 col-md-offset-1">
                        <ul>
                                {% ifequal status 'finish' %}
                                    <li class="title">填报完成</li>
                                    {% else %}
                                    <li class="title" style="background:red;">填报未完成</li>
                                {% endifequal %}

                            {% for app in Applist %}
                                {% ifequal status 'finish' %}
                                    {% ifequal app.app_status '未确认' %}
                                   <li class="unsubmit"><a href="javascript:;">{{ app.app_name }}<span> 已完成</span></a></li>
                                    {% else %}
                                    <li class="submit"><a href="javascript:;">{{ app.app_name }}<span>已完成 </span></a></li>
                                {% endifequal %}
                                    {% else %}
                                    {% ifequal app.app_status '未确认' %}
                                   <li class="unsubmit"><a href="{{ app.app_url }}">{{ app.app_name }}<span>{{ app.app_status }}</span></a></li>
                                    {% else %}
                                    <li class="submit"><a href="{{ app.app_url }}">{{ app.app_name }}<span>{{ app.app_status }}</span></a></li>
                                {% endifequal %}
                                {% endifequal %}


                            {% endfor %}
                        </ul>  
            	   </div>
                
			</div>
            <div class="pull-center">
                {% ifequal status 'submit' %}
                    <a href="/submitAllMenuByFill/" id="btnSmit" class="btn btn-success btn-lg">全 部 提 交</a>

                {% endifequal %}
                {% ifequal status 'no submit' %}
                    <a href="javascript:;" id="btnSmit" class="btn btn-primary btn-lg" disabled="disabled">全 部 提 交</a>

                {% endifequal %}


            </div><br><br>
        </div>
    </div>
</div>
{% endblock %}

{% block js %}
<script type="text/javascript">
    $(function(){
        var uls = document.getElementsByTagName('ul');
        var btnSmit = document.getElementById("btnSmit");
        var modifyBtns = document.getElementsByTagName("a");
        for (var i = 0; i < uls.length; i++) {
            if(uls[i].className=="ul"){
                var lis = uls[i].getElementsByTagName('li');
                for (var j = 0; j < lis.length; j++) {
                    var spanText = lis[j].children[0].children[0].innerHTML;
                    if (spanText=="未确认") {
                        uls[i].nextElementSibling.style.display = "none";
                        btnSmit.setAttribute("disabled",false)
                    };
                };
            }
        };
        for (var i = 0; i < modifyBtns.length; i++) {
            if (modifyBtns[i].innerHTML=="修改") {
                (function(n){
                    modifyBtns[i].onclick=function(){
                        this.parentNode.style.display="none";
                    }
                })(i)
            };
        };
    })
    
</script>
{% endblock %}